package net.huashitong.appsecurity;

import org.apache.shiro.authc.AuthenticationToken;

/**
 * app 的token类
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.08.21
 */
public class AppToken implements AuthenticationToken {

    private String username;//用户ID

    private String sign;//签名

    private Long timestamp;//时间戳

    public AppToken(String username, String sign, Long timestamp) {
        this.username = username;
        this.sign = sign;
        this.timestamp = timestamp;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    @Override
    public Object getPrincipal() {
        return this.username;
    }

    @Override
    public Object getCredentials() {
        return this.sign;
    }
}
